import * as vscode from 'vscode';

export class I18nColorProvider {
    private validTranslationDecorationType: vscode.TextEditorDecorationType;
    private invalidTranslationDecorationType: vscode.TextEditorDecorationType;

    constructor() {
        const config = vscode.workspace.getConfiguration('i18nHelper');
        const colors = config.get<{ validTranslation: string; invalidTranslation: string }>('colors', {
            validTranslation: '#6A9955',
            invalidTranslation: '#F44747'
        });

        this.validTranslationDecorationType = vscode.window.createTextEditorDecorationType({
            color: colors.validTranslation
        });

        this.invalidTranslationDecorationType = vscode.window.createTextEditorDecorationType({
            color: colors.invalidTranslation,
            textDecoration: 'underline wavy'
        });
    }

    public updateDecorations(editor: vscode.TextEditor, validRanges: vscode.Range[], invalidRanges: vscode.Range[]) {
        editor.setDecorations(this.validTranslationDecorationType, validRanges);
        editor.setDecorations(this.invalidTranslationDecorationType, invalidRanges);
    }

    public dispose() {
        this.validTranslationDecorationType.dispose();
        this.invalidTranslationDecorationType.dispose();
    }
} 